﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Automobile.service.Common;
using Automobile.service.Model;
using System.Data;
using System.Data.SqlClient;
namespace Automobile.service.DAL
{
   public class JournalDAL
    {
       SQLHelper H = new SQLHelper();
       /// <summary>
       /// 日志显示
       /// </summary>
       /// <returns></returns>
       public List<Journal>Journal_Show()
       {

           string str = "select Journa_Date,JournalIP,Employee_Name,Journa_Content from Journal inner join Employee on Journal.Employee_Id=Employee.Employee_Id";
           DataTable table = H.ExecDataTable(str);
           List<Journal > list = new List<Journal>();
           foreach (DataRow item in table.Rows)
           {
               Journal J= new Journal();
               J.Employee_Name = item["Employee_Name"].ToString();
               J.Journa_Date = Convert.ToDateTime(item["Journa_Date"]);
               J.Journa_Content = item["Journa_Content"].ToString();
               J.JournalIP = item["JournalIP"].ToString();
               list.Add(J);
           }
           return list;
       }
    /// <summary>
    /// 添加信息
    /// </summary>
    /// <param name="n"></param>
    /// <returns></returns>
       public int add(Journal n)
       {

           string str = "insert into Journal values('" + DateTime.Now + "','"+n.Employee_Id+"','"+n.Journa_Content+"','"+n.JournalIP+"')";
            return H.ExecNonquery(str);
       }
    }
}
